package com.bangyu.monitor.modular.system.entity;

import com.bangyu.monitor.core.util.FormatUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;

/**
 * @Auther: zhangxue
 * @Date: 19/5/28 21:52
 * @Description:
 */
@Data
public class MonitorInfoSummary {

    private String customerName;
    private String startTime;
    private String endTime;
    private Integer managerCount;//管理数量
    private Integer monitorCount;//监测数量
    private String rate;//检测数量占管理数量的比重
    private Integer warnCount;//预警桥梁数量
    private Integer alarmCount;//报警桥梁数量
    private Integer maintainCount;//维护数量



    //计算监控桥梁的比例
    public void cacuRate(){
        if(managerCount != null && managerCount != 0 && monitorCount != null){
            BigDecimal managerCountDec = new BigDecimal(managerCount);
            BigDecimal monitorCountDec = new BigDecimal(monitorCount);
            setRate(FormatUtil.percentFormat(monitorCountDec.divide(managerCountDec,6,RoundingMode.CEILING)));
        }
    }



}
